package org.hl7.fhir.r5.test.profiles.codegen;

import java.util.List;
import java.util.ArrayList;
import javax.annotation.Nullable;
import java.util.Date;


import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.model.*;
import org.hl7.fhir.r5.profilemodel.PEBuilder;
import org.hl7.fhir.r5.profilemodel.PEInstance;
import org.hl7.fhir.r5.profilemodel.PEBuilder.PEElementPropertiesPolicy;
import org.hl7.fhir.r5.profilemodel.gen.PEGeneratedBase;
import org.hl7.fhir.r5.profilemodel.gen.Min;
import org.hl7.fhir.r5.profilemodel.gen.Max;
import org.hl7.fhir.r5.profilemodel.gen.Label;
import org.hl7.fhir.r5.profilemodel.gen.Doco;
import org.hl7.fhir.r5.profilemodel.gen.BindingStrength;
import org.hl7.fhir.r5.profilemodel.gen.ValueSet;
import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
import org.hl7.fhir.r5.profilemodel.gen.Definition;


// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm

/**
 * Identifier holding the official identifier for a danish municipality
 *
 */
public class MunicipalityCodes extends PEGeneratedBase {

  public static final String CANONICAL_URL = "http://hl7.dk/fhir/core/StructureDefinition/dk-core-municipalityCodes|3.2.0";

  @Min("0") @Max("1") @Doco("Value of extension")
  @Definition("Value of extension - must be one of a constrained set of the data types (see [Extensibility](http://hl7.org/fhir/R4/extensibility.html) for a list).")
  private CodeableConcept value;  // Value of extension


  /**
   * Parameter-less constructor.
   *
   */
  public MunicipalityCodes() {
  }

  /**
   * Used when loading other models 
   *
   */
  public static MunicipalityCodes fromSource(PEInstance source) {
    MunicipalityCodes theThing = new MunicipalityCodes();
    theThing.workerContext = source.getContext();
    theThing.load(source);
    return theThing;
  }

  public void load(PEInstance src) {
    clear();
    if (src.hasChild("value[x]")) {
      value = (CodeableConcept) src.child("value[x]").asDataType();
    }

  }

  public void save(PEInstance tgt, boolean nulls) {
    tgt.clear("value[x]");
    if (value != null) {
      tgt.addChild("value[x]", value);
    }

  }

  /**
   * Value of extension - must be one of a constrained set of the data types (see 
   * [Extensibility](http://hl7.org/fhir/R4/extensibility.html) for a list).
   *
   */
  public CodeableConcept getValue() {
    if (value == null) { value = new CodeableConcept(); }
    return value;
  }

  public MunicipalityCodes setValue(CodeableConcept value) {
    this.value = value;
    return this;
  }
  public boolean hasValue() {
    return value != null;
  }



  public void clear() {
    value = null;

  }

}
